package readtreefromfile;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class ReadFromTxtFile implements IRetrieveData {
	private String txtFilePath;
	
	public ReadFromTxtFile(String path){
		this.txtFilePath=path;
	}
	
	@Override
	public List<String> retrieve()throws IOException {

			BufferedReader bfr = new BufferedReader(new FileReader(new File(
					txtFilePath)));

			List<String> eachLine = new ArrayList<String>();
			String line;
			while ((line = bfr.readLine()) != null) {
				eachLine.add(line);
			}
			bfr.close();
			return eachLine;

	}

}
